package com.zzb.framework.config;

import com.alibaba.druid.filter.Filter;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.JdbcUtils;
import com.alibaba.druid.wall.WallConfig;
import com.alibaba.druid.wall.WallFilter;
import com.zzb.framework.multiplysubmit.MultiplySubmitInterceptor;
import com.zzb.framework.query.GenericQueryDAO;
import com.zzb.framework.query.mysql.MysqlGenericQueryDAO;
import com.zzb.framework.query.postgres.PostgresGenericQueryDAO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * 框架启动配置
 * Created by zhangzhenbin on 17-6-5.
 */
@Configuration
@ServletComponentScan("com.zzb.framework")
@ComponentScan("com.zzb.framework")
@EnableTransactionManagement
public class FrameworkConfig {
    private static final Logger logger = LoggerFactory.getLogger(FrameworkConfig.class);

    @Bean
    @Autowired
    public GenericQueryDAO genericQueryDAO(JdbcTemplate jdbcTemplate) {
        return new MysqlGenericQueryDAO(jdbcTemplate);
    }

}
